package com.dao.impl;

import org.hibernate.Session;

import com.bussiness.domain.Location;
import com.dao.GeoCodeDao;

public class GeoCodeDaoImpl implements GeoCodeDao {
	private Session session;
	
	public GeoCodeDaoImpl() {
		session = HibernateUtil.openSession();
	}

	@Override
	public Long save(Location location) {
		session = HibernateUtil.openSession();
		session.beginTransaction();
		Long i = (Long) session.save(location);
		session.getTransaction().commit();
		if (i!=null){ 
			System.out.println(i);
			return i;}
		else return null;
	}

	@Override
	public boolean delete(Location location) {
		session.beginTransaction();
		session.delete(location);
		session.getTransaction().commit();
		return true;
	}

	@Override
	public boolean update(Location location) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Location read(Location location) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
